package org.dromara.system.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum SysUserProfitRecordsEnum {

    RENEW(1, "续期奖励"),
    WITHDRAWAL_POINTS(3, "积分提现"),
    WITHDRAWAL_REJECTED_POINTS(4, "积分提现驳回"),
    MALL_PROFIT(5, "商城购卡分润"),
    ;
    @JsonValue
    @EnumValue
    private final Integer code;
    private final String name;

    public static SysUserProfitRecordsEnum findOne(Integer code) {
        return Arrays.stream(SysUserProfitRecordsEnum.values())
            .filter(type -> type.getCode().equals(code)).findAny().orElse(null);
    }
}
